<%-- 
    Document   : showLog
    Created on : Nov 16, 2012, 5:19:36 PM
    Author     : mruiz
--%>

<%@page import="java.io.*"%>

<%
    StringWriter result = new StringWriter();
// load a configuration parameter (you must set this yourself)
    String logFilePath = getServletContext().getRealPath("/WEB-INF/classes/files/log.txt");

    // print the file
    InputStream in = null;
    try {
        in = new BufferedInputStream(new FileInputStream(logFilePath));
        int ch;
        while ((ch = in.read()) != -1) {
            result.write((char) ch);
        }
    } finally {
        if (in != null) {
            in.close();
        }
    }
%>


<script type="text/javascript">
    $(document).ready(function () {
        $('#log').hide();

        $('#showlog').click(function () {
            $('#log').toggle(400);
        });
    });
</script>
<div id="showlog" class="pull-right">
    <a class="btn btn-large btn-inverse" type="btn"><i class="icon-align-center"></i> &nbsp;Show/Hide Log</a>
</div>
<br/><br/><br/>
<div id="log">
    <form>
        <fieldset>
            <legend><i class="icon-tasks"> </i> Log console:</legend>
            <textarea style="background-color: #43474f; color: #49ff32" id="outputTextResultsArea" name="log" cols="140" rows="6" readonly="readonly"> <%=result%></textarea>
        </fieldset>
    </form>
</div>



<script type="text/javascript">
    var textArea = document.getElementById('outputTextResultsArea');
    textArea.scrollTop = 99999;
</script>
</div>



